package com.jy.modules.cims.data.dao;

import java.util.List;
import java.util.Map;

import com.jy.modules.cims.data.common.dto.TCMmCostPlanDTO;
import com.jy.platform.core.mybatis.MyBatisRepository;

/**
 * @classname: CostPlanDao
 * @description: 定义 结算计划 持久层 接口
 * @author: shengzhoutao
 */
@MyBatisRepository
public interface CostPlanDao {
	/**
	 * @description:按照输入条件查询最近一期应该结算的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public List<TCMmCostPlanDTO> searchCostPlanForSettle(Map<String, Object> searchParams);

	/**
	 * @description:查询某一结算日期剩余的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public List<TCMmCostPlanDTO> searchSurplusCostPlan(Map<String, Object> searchParams);
	
	/**
	 * @description:按照输入条件统计提前结清的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public TCMmCostPlanDTO statCostPlanForAdvanceFinish(Map<String, Object> searchParams);

	/**
	 * @description:按照输入条件统计应该结算的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public TCMmCostPlanDTO statCostPlanForPackage(Map<String, Object> searchParams);
	
	/**
	 * @description:按照输入条件统计应该结算的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public TCMmCostPlanDTO batchStatCostPlanForSettle(Map<String, Object> searchParams);
	

	/**
	 * @description:按照输入条件统计应该结算的结算计划
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public TCMmCostPlanDTO statCostPlanForSettle(Map<String, Object> searchParams);

	/**
	 * @description:根据流水号查询结算计划(已经结算)
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 * @return
	 */
	public List<TCMmCostPlanDTO> searchCostPlanByDealCode(Map<String, Object> searchParams);

	/**
	 * @description:根据债权信息修改结算计划表的结算状态
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 */
	public int updateCostPlanStatusByCredit(Map<String, Object> searchParams);

	/**
	 * @author 周鹏
	 * @description: 根据条件 更新对结算债权价值 以及结算标识
	 * @date 2015-12-18 16:21:49
	 * @param paramMap
	 */
	public void updateTCMmCostPlanbyTransferId(Map<String, Object> paramMap);

	/**
	 * @description:根据债权信息修改结算计划表的结算状态
	 * @author shengzhoutao
	 * @date 2015-01-07 16:21:57
	 * @param searchParams
	 */
	public int updateCostPlanStatusForSettle(Map<String, Object> searchParams);

	/**
	 * 
	 * @Description 根据债权明细月还，修改债权结算计划的月还
	 * @author zhangmi
	 * @date 2016-3-31
	 */
	public void updateThisRepaySumSql(Map<String, Object> searchParams) throws Exception;

	/**
	 * 删除数据
	 * 
	 * @param transferId
	 *            void
	 * @throws
	 * @author zhangmi
	 * @date 2016-3-3
	 */
	public void deleteTCMmCostPlanByTransferId(String transferId); // 结算计划

	public void deleteTCMmRefundPlanByTransferId(String transferId);// 还款计划

	/**
	 * 
	 * @Description 查询剩余应还本，应还息 TCMmCostPlanDTO
	 * @author zhangmi
	 * @date 2016-4-7
	 */
	public TCMmCostPlanDTO getSumMustAmountAccrual(Map<String, Object> searchParams);

	/**
	 * @Description 批量复制结算计划
	 * @author zhangmi
	 * @date 2016-4-7
	 * @param costPlanList
	 *            结算计划
	 */
	public void insertCostPlan(List<TCMmCostPlanDTO> costPlanList);

	/**
	 * @Description 批量复制还款计划
	 * @author zhangmi
	 * @date 2016-4-7
	 * @param costPlanList
	 *            结算计划
	 */
	public void copyRefundPlan(Map<String, Object> searchParams);

	/**
	 * @Description 批量新增结算计划
	 * @author zhangmi
	 * @date 2016-4-7
	 * @param costPlanList
	 *            结算计划
	 */
	public void copyCostPlan(Map<String, Object> searchParams);

	/**
	 * @description 按照合约的结算参数重新计算非提前结算的结算计划返回金额和匹配金额
	 * @author shengzhoutao
	 * @param searchParams
	 */
	public void updateCostPlanForNormalSettle(Map<String, Object> searchParams);

	/**
	 * @description 按照合约的结算参数重新计算提前结算的结算计划返回金额和匹配金额
	 * @author shengzhoutao
	 * @param searchParams
	 */
	public void updateCostPlanForAdcanceFinish(Map<String, Object> searchParams);
	
	/**
	 * 根据债权编号与转让编号累计当前期数以后的剩余本金之和
	 * */
	public TCMmCostPlanDTO searchTCMmCostPlanMustAmount(Map<String, Object> searchParams);
	
	/**
	 * @description:按照输入条件查询结算计划
	 * @author shengzhoutao
	 * @date 2015-12-07
	 * @param searchParams
	 * @return
	 */
	public List<TCMmCostPlanDTO> searchTCMmCostPlan(Map<String, Object> searchParams);
	
	
	/**
	 * @description 终止当天转让确认对应结算计划表的结算状态
	 * @author shengzhoutao
	 * @param searchParams
	 */
	public void endCostPlanForCurrentConfirmCredit(Map<String, Object> searchParams);

}
